package com.zjy.config;

import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpLogic;
import com.zjy.business.system.common.SysPermissionCommon;
import com.zjy.satoken.PermissionStpInterface;
import com.zjy.web.config.PlusSaTokenDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangjianyu
 * email: 578547270@qq.com
 * create_time: 2024-10-21 12:01
 * description:
 */
@Configuration
public class SaTokenConfig {

    @Bean
    public StpLogic getStpLogicJwt() {
        return new StpLogicJwtForSimple();
    }

    @Bean
    public StpInterface stpInterface(SysPermissionCommon sysPermissionCommon) {
        return new PermissionStpInterface(sysPermissionCommon);
    }

    /**
     * 自定义dao层存储
     */
    @Bean
    public SaTokenDao saTokenDao() {
        return new PlusSaTokenDao();
    }

}
